﻿using Adp;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Yqd.Models;
using Microsoft.Extensions.Hosting;
using Yqd.Core;

namespace Yqd
{
    public class Startup
    {
        public PlusInfo PlusInfo
        {
            get
            {
                return new PlusInfo
                {
                    PlusName = "义起督" 
                };
            }
        }
        public void ConfigureServices(IServiceCollection services, IConfiguration configuration, ILogger _logger)
        {
            //添加数据库
            services.AddDbContext<YqdContext>(options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

            //添加应用服务
            services.AddTransient<DdService>();
            services.AddTransient<TaskLogService>();

            //一小时定时更新部门积分
            services.AddSingleton<IHostedService, RankHostService>();
            //一小时定时更新冻结节点数据预警信息
            services.AddSingleton<IHostedService, UpDataToYiWuHostService>();
            //一小时定时更新指标清单预警信息
            services.AddSingleton<IHostedService, UpQuotaTableHostService>();

            //10分钟定时检查自动推送部门效能评价报告
            services.AddSingleton<IHostedService, workNotificationHostService>();
       
            
            //一小时定时更新督导协调滞后状态
            services.AddSingleton<IHostedService, SuperviseHostService>();
        }
        public void Configure(IApplicationBuilder app, IConfiguration configuration, IHostingEnvironment env, ILogger _logger)
        {
        }
    }
}
